package org.bcncoding.appengine.droiding.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;

public class AboutDialog extends DialogBox {

	public AboutDialog() {
		setText("About the Droiding Application");
		VerticalPanel outer = new VerticalPanel();
		HTML text = new HTML(
				"This application is used to manage all the bike providers and stations");
		outer.add(text);
		outer.add(new Button("Close", new ClickHandler() {
			public void onClick(ClickEvent event) {
				hide();
			}
		}));
		setWidget(outer);
	}

	@Override
	public boolean onKeyDownPreview(char key, int modifiers) {
		switch (key) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_ESCAPE:
			hide();
			break;
		}
		return true;
	}
}
